#!/bin/bash
#user=$(echo ${saks:0:5})

fun_ovpn_onl () {
for userovpn in `cat /etc/passwd | grep ovpn | awk -F: '{print $1}'`; do
us=$(cat /etc/openvpn/openvpn-status.log | grep $userovpn | wc -l)
if [ "$us" != "0" ]; then
echo "$userovpn"
fi
done
}

net_meter () {
net_dir="/etc/adm-lite/userDIR/usr_cnx"
if [ ! -e "$net_dir" ]; then
echo -e "${cor[5]} ${txt[289]}"
echo -e "${cor[1]} ===================================\033[0m"
return
fi
net_cent="/tmp/porcentagem"
sed -i '/^$/d' $net_dir
 [[ ! -e "$net_cent" ]] && touch $net_cent
 while read cent; do
  echo "$cent" | awk '{print $2}' >> $net_cent
 done < $net_dir
 por_cent=$(paste -sd+ $net_cent | bc)
 rm $net_cent
bb=$(printf '%-18s' "${txt[285]}")
aa=$(printf '%-19s' "${txt[287]}")
cc=$(printf '%-18s' "${txt[286]}")
echo -e "${cor[1]} ===================================\033[0m"
echo -e "\033[1;33m $aa $bb $cc"
echo -e "${cor[1]} ===================================\033[0m"
while read u; do
b=$(printf '%-18s' "$(($(echo $u | awk '{print $2}')/970)) - MB")
a=$(printf '%-20s' "$(echo $u | awk '{print $1}')")
[[ "$por_cent" = "0" || "$por_cent" = "" ]] && por_cent="1"
pip=$(echo $u | awk '{print $2}')
[[ "$pip" = "" || "$pip" = "0" ]] && pip="1"
percent_user=$(($pip*100/$por_cent)) > /dev/null 2>&1
[[ $percent_user = "0" ]] && percent_user="1"
c=$(printf '%-18s' "$percent_user %%")
if [ "$(($(echo $u | awk '{print $2}')/970))" -gt "1" ]; then
echo -e "\033[1;32m $a \033[1;31m$b \033[1;32m$c"
fi
done < $net_dir
[[ "$(cat $net_dir)" = "" ]] && echo -e "${cor[5]} ${txt[289]}"
echo -e "${cor[1]} ===================================\033[0m"
unset net_dir
}

drop_kill () {
user="$1"
tmp_verifica="./tmp_tmp"
function_dropb | grep "$user" | awk '{print $2}' > $tmp_verifica
echo "$user $for_kill"
    for pid in `cat  $tmp_verifica`; do
    kill $pid
    done
rm $tmp_verifica
}

fun_time_user () {
declare -A data
tempousers="./tempo_conexao"
usr_pids_var="./userDIR"
user_x="$1"
if [ -e $usr_pids_var/$user_x.pid2 ]; then
source $usr_pids_var/$user_x.pid2
[[ ${data[$user_x]} != +([0-9]) ]] && data[$user_x]="0"
_data_now=$(date +%s)
time[$user_x]=$(($_data_now - ${data[$user_x]}))
else
time[$user_x]="0"
fi
}

function_dropb () {  
port_dropbear=`ps aux | grep dropbear | awk NR==1 | awk '{print $17;}'`
[[ $port_dropbear = "" ]] && return
log=/var/log/auth.log
loginsukses='Password auth succeeded'
echo ' '
pids=`ps ax |grep dropbear |grep  " $port_dropbear" |awk -F" " '{print $1}'`
for pid in $pids
do
    pidlogs=`grep $pid $log |grep "$loginsukses" |awk -F" " '{print $3}'`
    i=0
    for pidend in $pidlogs
    do
    let i=i+1
    done
    if [ $pidend ]; then
       login=`grep $pid $log |grep "$pidend" |grep "$loginsukses"`
       PID=$pid
       user=`echo $login |awk -F" " '{print $10}' | sed -r "s/'/ /g"`
       waktu=`echo $login |awk -F" " '{print $2"-"$1,$3}'`
       while [ ${#waktu} -lt 13 ]; do
       waktu=$waktu" "
       done
       while [ ${#user} -lt 16 ]; do
       user=$user" "
       done
       while [ ${#PID} -lt 8 ]; do
       PID=$PID" "
       done
     echo "$user $PID $waktu"
    fi
done
echo ""
return
}

function_1 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} ${txt[38]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
for u in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |grep -v "nobody" |grep -vi polkitd |grep -vi system-`; do
echo -e "${cor[5]} $u"
done
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} ${txt[27]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[28]}"; read -p " ≈≈≈≈≈> " name
if [ -z $name ]; then
echo -e "${cor[5]} ${txt[29]} ${cor[0]}" 
return
fi
if cat /etc/passwd |grep $name: |grep -vi [a-z]$name |grep -v [0-9]$name > /dev/null
then
echo -e "${cor[5]} ${txt[30]} ${cor[0]}"
return
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[31]} $name"
read -p " ${txt[35]} " pass
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[32]}  $name"
read -p " ${txt[37]} " daysrnf
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[33]}  $name"
read -p " ${txt[36]} " limit
echo -e "${cor[1]} =================================== ${cor[0]}"
meu_ip
if [ "$OPENVPN" = "on" ]; then
open_1 $name $pass $daysrnf $limit s
echo -e "${cor[5]} IP => ${cor[4]}$IP"
echo -e "${cor[5]} ${txt[34]} ${cor[4]}$name"
echo -e "${cor[5]} ${txt[35]} ${cor[4]}$pass"
echo -e "${cor[5]} ${txt[36]} ${cor[4]}$limit"
echo -e "${cor[5]} ${txt[37]} ${cor[4]}$datexp"
echo -e "${cor[1]} =================================== ${cor[0]}"
rm ./$CLIENT.ovpn > /dev/null 2>&1
return
fi
valid=$(date '+%C%y-%m-%d' -d " +$daysrnf days")
datexp=$(date "+%d/%m/%Y" -d " +$daysrnf days")
useradd -M -s /bin/false $name -e $valid
(echo $pass; echo $pass)|passwd $name 2>/dev/null
echo -e "${cor[5]} IP => ${cor[4]}$IP"
echo -e "${cor[5]} ${txt[34]} ${cor[4]}$name"
echo -e "${cor[5]} ${txt[35]} ${cor[4]}$pass"
echo -e "${cor[5]} ${txt[36]} ${cor[4]}$limit"
echo -e "${cor[5]} ${txt[37]} ${cor[4]}$datexp"
echo -e "${cor[1]} =================================== ${cor[0]}"
echo "senha: $pass" > $dir_user/$name
echo "limite: $limit" >> $dir_user/$name
echo "data: $valid" >> $dir_user/$name
echo -ne "${cor[2]}"
return
}

function_2 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} ${txt[39]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[2]} |1| >${cor[3]} ${txt[40]}"
echo -e "${cor[2]} |2| >${cor[3]} ${txt[41]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -ne "${cor[6]}"
read -p "${txt[9]} " opc_del
if [ "$opc_del" = "1" ]; then
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} ${txt[38]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
select_users
name="$select_name"
if [ "$name" = "" ]; then
return
fi
if [ "$OPENVPN" = "on" ]; then
open_2 $name
echo -e "${cor[1]} =================================== ${cor[0]}"
return
fi
userdel --force $name > /dev/null 2>/dev/null
kill -9 `ps aux |grep -vi '[a-z]$name' |grep -vi '$name[a-z]' |grep -v '[1-9]$name' |grep -v '$name[1-9]' |grep $name |awk {'print $2'}` 2> /dev/null
pid_kill=$(function_dropb | grep "$name" | awk '{print $2}')
if [ "$pid_kill" != "" ]; then
drop_kill $name
fi
if [ -e $dir_user/$name ]; then
rm $dir_user/$name
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " $name ${cor[2]} ${txt[45]} "
echo -e "${cor[1]} =================================== ${cor[0]}"
return
fi
 if [ "$opc_del" = "2" ]; then
for name in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |grep -v "nobody" |grep -vi polkitd |grep -vi system-`; do
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[46]} $name ?"
read -p " [S/N]: " _remover_
if [[ "$_remover_" = "s" || "$_remover_" = "S" ]]; then
 if [ "$OPENVPN" = "on" ]; then
open_2 $name
 else
userdel --force $name > /dev/null 2>&1
kill -9 `ps aux |grep -vi '[a-z]$name' |grep -vi '$name[a-z]' |grep -v '[1-9]$name' |grep -v '$name[1-9]' |grep $name |awk {'print $2'}`  > /dev/null 2>&1
pid_kill=$(function_dropb | grep "$name" | awk '{print $2}')
if [ "$pid_kill" != "" ]; then
drop_kill $name
fi
if [ -e $dir_user/$name ]; then
rm $dir_user/$name
fi
echo -e "\033[1;37m $name ${cor[5]} ${txt[46]}"
sleep 0.3s
 fi
fi
done
echo -e "${cor[1]} =================================== ${cor[0]}"
else
return
fi
}


function_3 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} ${txt[48]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
select_users
if [ "$select_name" = "" ]; then
return
fi
namer="$select_name"
echo -e "${cor[5]} ${txt[50]} $namer"
echo -e "${cor[2]} |1| >${cor[3]} ${txt[51]} $namer"
echo -e "${cor[2]} |2| >${cor[3]} ${txt[52]} $namer"
echo -e "${cor[2]} |3| >${cor[3]} ${txt[53]} $namer"
echo -e "${cor[1]} =================================== ${cor[0]}"
read -p " ${txt[9]} " _opt
if [ "$_opt" = "1" ]; then
read -p "${txt[54]} " new_limit
 if [ "$new_limit" = "" ]; then
echo -e "${cor[5]} ${txt[55]}"
return
 fi
usr_var=$(cat $dir_user/$namer | grep -v "limite:")
echo "$usr_var" > $dir_user/$namer
echo "limite: $new_limit" >> $dir_user/$namer
echo -e "${cor[5]} ${txt[56]}"
unset new_limit
unset usr_var
return
fi
if [ "$_opt" = "2" ]; then
echo -e "${cor[5]} ${txt[57]}"
read -p ": " date
 if [ "$date" = "" ]; then
echo -e "${cor[5]} ${txt[58]}"
return
 fi
datexp=$(date "+%d/%m/%Y" -d " + $date days")
valid=$(date '+%C%y-%m-%d' -d " + $date days")
chage -E $valid $namer 2> /dev/null
echo -e "${cor[5]} ${txt[59]}"
usr_var=$(cat $dir_user/$namer | grep -v "data")
echo -e "$usr_var" > $dir_user/$namer
echo -e "data: $valid" >> $dir_user/$namer
echo -e "$namer: $datexp"
unset datexp
unset valid
unset usr_var
return
fi
if [ "$_opt" = "3" ]; then
echo -e "${cor[5]} ${txt[60]} $namer"
read -p " : " nova_senha
if [ "$nova_senha" = "" ]; then
echo -e "${cor[5]} ${txt[61]}"
return
fi
(echo "$nova_senha" ; echo "$nova_senha" ) |passwd $namer > /dev/null 2>/dev/null
usr_var1=$(cat $dir_user/$namer | grep -v "senha")
echo -e "$usr_var1" > $dir_user/$namer
echo -e "senha: $nova_senha" >> $dir_user/$namer
echo -e "${cor[5]} ${txt[62]}"
unset nova_senha
unset usr_var1
return
else
echo -e "${cor[5]} ${txt[63]}"
fi
}

function_4 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]}  >  ${txt[64]}    ${txt[65]}   ${txt[66]}     ${txt[85]}        ${txt[67]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
_cont="0"
if [ ! -e $tempousers ]; then
touch $tempousers
fi
for namer in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |grep -v "nobody" |grep -vi polkitd |grep -vi system-`; do
if [ "$namer" = "" ]; then
break
fi
if [ -e $dir_user/$namer ]; then
_sen=$(cat $dir_user/$namer | grep "senha" | awk '{print $2}')
_limit=$(cat $dir_user/$namer | grep "limite" | awk '{print $2}')
else
_limit="${txt[68]}"
_sen="${txt[68]}"
fi
 if [ -z "$_limit" ]; then
_limit="${txt[68]}"
 fi
 if [ -z "$_sen" ]; then
_sen="${txt[68]}"
 fi
data_sec=$(date +%s)
data_user=$(chage -l "$namer" |grep -i co |awk -F ":" '{print $2}')
if [ "$data_user" = " never" ]; then
dias_user="\033[1;37m${txt[69]}"
 else
data_user_sec=$(date +%s --date="$data_user")
 if [ "$data_sec" -gt "$data_user_sec" ]; then
dias_user="\033[1;31m${txt[70]}"
else
variavel_soma=$(($data_user_sec - $data_sec))
dias_use=$(($variavel_soma / 86400))
dias_user="\033[1;32m$dias_use ${txt[73]}"
 fi
fi
unset SEC
unset MIN
unset HOR
SEC=$(cat $tempousers | grep "$namer" | awk '{print $2}')
number_var $SEC
if [ "$var_number" = "" ]; then
SEC="0"
 else
SEC="$var_number"
fi
hour_var=$(echo "${txt[83]}" | cut -b 1)
min_var=$(echo "${txt[84]}" | cut -b 1)
MIN=$(($SEC / 60))
SEC=$(($SEC - $MIN * 60))
HOR=$(($MIN / 60))
MIN=$(($MIN - $HOR * 60))
txto[1]=$(printf '%-10s' "$namer")
txto[2]=$(printf '%-12s' "$_sen")
txto[3]=$(printf '%-10s' "$_limit")
txto[4]=$(printf '%-10s' "${HOR}h:${MIN}m:${SEC}s")
txto[5]=$(printf '%-2s' "$dias_user")
unset open_vpn
echo "$(cat /etc/passwd | grep -v ovpn | awk -F : '$3 > 900 { print $1 }' |grep -v "nobody" | grep -vi polkitd |grep -vi system-)" > $_tmp
open_vpn=$(cat $_tmp | grep "$namer")
rm $_tmp
if [ "$open_vpn" != "" ]; then
#user ssh
echo -e " ${cor[2]} > ${cor[5]} ${txto[1]} ${txto[2]} ${txto[3]} ${txto[4]} ${txto[5]}"
 else
#user openvpn
echo -e " ${cor[2]} > ${cor[7]} ${txto[1]} ${txto[2]} ${txto[3]} ${txto[4]} ${txto[5]}"
fi
_cont=$(($_cont + 1))
done
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " ∆ ${txt[71]} $_cont ${txt[72]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
unset txt_
}

function_5 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
msga[1]=$(printf '%-12s' "${txt[74]}")
msga[2]=$(printf '%-9s' "${txt[75]}")
msga[3]=$(printf '%-6s' "${txt[76]} HH:MM")
echo -e "${cor[4]} ${msga[1]} ${msga[2]} ${msga[3]} ${cor[0]}"
unset msga
echo -e "${cor[1]} =================================== ${cor[0]}"
[[ ! -e $tempousers ]] && touch $tempousers
_data_now=$(date +%s)
for user in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |grep -v "nobody" |grep -vi polkitd |grep -vi system-`; do
unset ssh
ssh+="$(ps -u $user|grep sshd|wc -l)+"
ssh+="$(function_dropb|grep "$user"|wc -l)+"
[[ "$OPENVPN" = "on" ]] && ssh+="$(fun_ovpn_onl|grep "$user"|wc -l)+" 
ssh+="0"
user_pid=$(echo $ssh|bc)
declare -A time
fun_time_user "$user"
SEC="${time[$user]}"
[[ "$SEC" = "" ]] && SEC="0"
[[ "$SEC" != +([0-9]) ]] && SEC="0"
hour_var=$(echo "${txt[83]}" | cut -b 1)
min_var=$(echo "${txt[84]}" | cut -b 1)
MIN=$(($SEC/60))
SEC=$(($SEC-$MIN*60))
HOR=$(($MIN/60))
MIN=$(($MIN-$HOR*60))
msg[1]=$(printf '%-12s' "${user}")
msg[2]=$(printf '%-7s' "${user_pid}")
msg[3]=$(printf '%-1s' "${HOR}h:${MIN}m:${SEC}s")
if [ "$user_pid" -gt "0" ]; then
echo -e "\033[1;32m ${msg[1]} ${msg[2]} ${msg[3]} ${cor[0]}"
algumon="on"
 else
 [[ -e $usr_pids_var/$user.pid2 ]] && rm $usr_pids_var/$user.pid2
fi
done
[[ "$algumon" = "" ]] &&  echo -e "\033[1;31m ${txt[86]}" && unset algumon
echo -e "${cor[1]} =================================== ${cor[0]}"
}

function_6 () {
unset _removidos
echo -e "${cor[1]} =================================== ${cor[0]}"
datenow=$(date +%s)
for user in $(awk -F: '{print $1}' /etc/passwd); do
expdate=$(chage -l $user|awk -F: '/Account expires/{print $2}')
echo $expdate|grep -q never && continue
datanormal=$(date -d"$expdate" '+%d/%m/%Y')
expsec=$(date +%s --date="$expdate")
diff=$(echo $datenow - $expsec|bc -l)
echo $diff|grep -q ^\- && continue
userdel --force $user > /dev/null 2>/dev/null
kill -9 `ps aux |grep -vi '[a-z]$user' |grep -vi '$user[a-z]' |grep -v '[1-9]$user' |grep -v '$user[1-9]' |grep $user |awk {'print $2'}` 2> /dev/null
pid_kill=$(function_dropb | grep "$user" | awk '{print $2}')
[[ "$pid_kill" != "" ]] && drop_kill $user
[[ "$OPENVPN" = "on" ]] && open_2 $name
[[ -e $dir_user/$user ]] && rm $dir_user/$user
_removidos="on"
echo -e "\033[1;37m $user ${cor[2]} ${txt[45]} "
done
if [ "$_removidos" = "" ]; then
echo -e "${cor[5]} ${txt[88]}"
unset _removidos
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
}

txt_font () {
echo -ne "\033[1;37m"
read -p " ${txt[226]}: " ban_ner2
echo -e " \033[1;31m[ 1 ]\033[1;33m - ${txt[227]}"
echo -e " \033[1;31m[ 2 ]\033[1;33m - ${txt[228]}"
echo -e " \033[1;31m[ 3 ]\033[1;33m - ${txt[229]}"
echo -e " \033[1;31m[ 4 ]\033[1;33m - ${txt[230]}"
echo -e " \033[1;31m[ 5 ]\033[1;33m - ${txt[231]}"
read -p " Digite A Cor [ 1 - 5 ]: " ban_ner2_cor
if [ "$ban_ner2_cor" = "1" ]; then
echo '<h6><font color="green">' >> $local
elif [ "$ban_ner2_cor" = "2" ]; then
echo '<h6><font color="red">' >> $local
elif [ "$ban_ner2_cor" = "3" ]; then
echo '<h6><font color="blue">' >> $local
elif [ "$ban_ner2_cor" = "4" ]; then
echo '<h6><font color="yellow">' >> $local
elif [ "$ban_ner2_cor" = "5" ]; then
echo '<h6><font color="purple">' >> $local
else
echo '<h6><font color="red">' >> $local
fi
echo "$ban_ner2" >> $local
echo "</h6></font>" >> $local
}

function_7 () {
echo -e "${cor[3]} "Realmente deseja adcionar um banner?""
read -p " [S/N]: " -e -i n sshsn
[[ "$sshsn" = @(s|S|y|Y) ]] && {
local2="/etc/dropbear/banner"
chk=$(cat /etc/ssh/sshd_config | grep Banner)
if [ "$(echo "$chk" | grep -v "#Banner" | grep Banner)" != "" ]; then
local=$(echo "$chk" |grep -v "#Banner" | grep Banner | awk '{print $2}')
 else
echo "Banner /etc/bannerssh" >> /etc/ssh/sshd_config
local="/etc/bannerssh"
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -ne "\033[1;37m"
read -p " ${txt[232]}: " ban_ner
echo -e " \033[1;31m[ 1 ]\033[1;33m - ${txt[227]}"
echo -e " \033[1;31m[ 2 ]\033[1;33m - ${txt[228]}"
echo -e " \033[1;31m[ 3 ]\033[1;33m - ${txt[229]}"
echo -e " \033[1;31m[ 4 ]\033[1;33m - ${txt[230]}"
echo -e " \033[1;31m[ 5 ]\033[1;33m - ${txt[231]}"
read -p " [ 1 - 5 ]: " ban_ner_cor
echo '<h1><font>=============================</font></h1>' > $local
if [[ "$ban_ner_cor" = "1" ]]; then
echo '<h1><font color="green">' >> $local
elif [[ "$ban_ner_cor" = "2" ]]; then
echo '<h1><font color="red">' >> $local
elif [[ "$ban_ner_cor" = "3" ]]; then
echo '<h1><font color="blue">' >> $local
elif [[ "$ban_ner_cor" = "4" ]]; then
echo '<h1><font color="yellow">' >> $local
elif [[ "$ban_ner_cor" = "5" ]]; then
echo '<h1><font color="purple">' >> $local
else
echo '<h1><font color="blue">' >> $local
fi
echo "$ban_ner" >> $local
echo '</font></h1>' >> $local
echo '<h1><font>=============================</font></h1>' >> $local
while true; do
echo -e " ${txt[233]}"
read -p " [ s | n ]: " sin_nao
if [[ "$sin_nao" = @(s|S|y|Y) ]]; then
txt_font
elif [[ "$sin_nao" = @(n|N) ]]; then
break
fi
done
echo '</h8><font color="purple">adm®</font></h8>' >> $local
echo '<h1><font>=============================</font></h1>' >> $local
if [ -e "$local2" ]; then
rm $local2  > /dev/null 2>&1
cp $local $local2 > /dev/null 2>&1
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
service ssh restart > /dev/null 2>&1 &
service sshd restart > /dev/null 2>&1 & 
service dropbear restart > /dev/null 2>&1 &
}
return 0
}
limiter_fun () {
[[ "$VERIFICAR" = "on" ]] && {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} LIMITER RUNNING IN VERIFICACION ${cor[0]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
return
}
   if [[ $limiter_on = "" ]]; then
   unset limiter_on
   chmod +x /etc/adm-lite/limiter.sh &
   /etc/adm-lite/limiter.sh &
   screen -dmS Limiter-ssh /etc/adm-lite/limiter.sh
   echo -e "${cor[1]} =================================== ${cor[0]}"
   echo -e "${cor[5]} LIMITER STARTS ${cor[0]}"
   echo -e "${cor[1]} =================================== ${cor[0]}"
   else
   unset limiter_on
   killall limiter.sh > /dev/null 2>&1
   kill -9 $(ps x|grep -v grep|grep limiter.sh|awk '{print $1}')
   echo -e "${cor[1]} =================================== ${cor[0]}"
   echo -e "${cor[5]} LIMITER STOPPED ${cor[0]}"
   echo -e "${cor[1]} =================================== ${cor[0]}"
   fi
}
[[ "$1" = "1" ]] && function_1
[[ "$1" = "2" ]] && function_2
[[ "$1" = "3" ]] && function_3
[[ "$1" = "4" ]] && function_4
[[ "$1" = "5" ]] && function_5
[[ "$1" = "6" ]] && function_6
[[ "$1" = "7" ]] && function_7
[[ "$1" = "8" ]] && net_meter
[[ "$1" = "9" ]] && limiter_fun
####_Eliminar_Tmps_####
[[ -e $_tmp ]] && rm $_tmp
[[ -e $_tmp2 ]] && rm $_tmp2
[[ -e $_tmp3 ]] && rm $_tmp3
[[ -e $_tmp4 ]] && rm $_tmp4
